﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdValue : OdStaticRxObject_OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdValue(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdValue_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdValue obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdValue()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdValue(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public static explicit operator string(OdValue v)
		{
			return v.AsString();
		}

		public static explicit operator int(OdValue v)
		{
			return v.AsInt32();
		}

		public static explicit operator long(OdValue v)
		{
			return v.AsInt64();
		}

		public static explicit operator OdDbObjectId(OdValue v)
		{
			return v.AsObjectId();
		}

		public static explicit operator double(OdValue v)
		{
			return v.AsDouble();
		}

		public new static OdValue cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdValue_cast(OdRxObject.getCPtr(pObj));
			OdValue result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdValue_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdValue_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdValue_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdValue createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdValue_createObject();
			OdValue result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdValue() : this(TD_DbPINVOKE.new_OdValue__SWIG_0(), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdValue(OdValue value) : this(TD_DbPINVOKE.new_OdValue__SWIG_1(OdValue.getCPtr(value)), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdValue(string value) : this(TD_DbPINVOKE.new_OdValue__SWIG_2(value), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdValue(int value) : this(TD_DbPINVOKE.new_OdValue__SWIG_3(value), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdValue(double value) : this(TD_DbPINVOKE.new_OdValue__SWIG_4(value), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdValue(out long date) : this(TD_DbPINVOKE.new_OdValue__SWIG_5(out date), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdValue(double x, double y) : this(TD_DbPINVOKE.new_OdValue__SWIG_6(x, y), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdValue(double x, double y, double z) : this(TD_DbPINVOKE.new_OdValue__SWIG_7(x, y, z), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdValue(OdDbObjectId objectId) : this(TD_DbPINVOKE.new_OdValue__SWIG_8(OdDbObjectId.getCPtr(objectId)), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdValue(OdResBuf resBuf) : this(TD_DbPINVOKE.new_OdValue__SWIG_9(OdResBuf.getCPtr(resBuf)), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdValue(IntPtr buffer, int bufferSize) : this(TD_DbPINVOKE.new_OdValue__SWIG_10(buffer, bufferSize), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool reset()
		{
			bool result = TD_DbPINVOKE.OdValue_reset__SWIG_0(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdValue.DataType dataType()
		{
			OdValue.DataType result = (OdValue.DataType)TD_DbPINVOKE.OdValue_dataType(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isValid()
		{
			bool result = TD_DbPINVOKE.OdValue_isValid(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public string AsString()
		{
			string result = TD_DbPINVOKE.OdValue_AsString(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public int AsInt32()
		{
			int result = TD_DbPINVOKE.OdValue_AsInt32(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double AsDouble()
		{
			double result = TD_DbPINVOKE.OdValue_AsDouble(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public long AsInt64()
		{
			long result = TD_DbPINVOKE.OdValue_AsInt64(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdDbObjectId AsObjectId()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr cPtr = TD_DbPINVOKE.OdValue_AsObjectId(this.swigCPtr);
			OdDbObjectId result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(new OdDbObjectId(cPtr, true));
				result = new OdDbObjectId(cPtr, false);
			}
			else
			{
				result = new OdDbObjectId(cPtr, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdValue Assign(OdValue value)
		{
			OdValue result = (OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdValue_Assign__SWIG_0(this.swigCPtr, OdValue.getCPtr(value)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdValue Assign(string value)
		{
			OdValue result = (OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdValue_Assign__SWIG_1(this.swigCPtr, value), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdValue Assign(int value)
		{
			OdValue result = (OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdValue_Assign__SWIG_2(this.swigCPtr, value), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdValue Assign(double value)
		{
			OdValue result = (OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdValue_Assign__SWIG_3(this.swigCPtr, value), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdValue Assign(long date)
		{
			OdValue result = (OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdValue_Assign__SWIG_4(this.swigCPtr, date), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdValue Assign(OdDbObjectId objectId)
		{
			OdValue result = (OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdValue_Assign__SWIG_5(this.swigCPtr, OdDbObjectId.getCPtr(objectId)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdValue Assign(OdResBuf resBuf)
		{
			OdValue result = (OdValue)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdValue_Assign__SWIG_6(this.swigCPtr, OdResBuf.getCPtr(resBuf)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool get(ref string value)
		{
			IntPtr intPtr = Marshal.StringToCoTaskMemUni(value);
			IntPtr value2 = intPtr;
			bool result;
			try
			{
				bool flag = TD_DbPINVOKE.OdValue_get__SWIG_0(this.swigCPtr, ref intPtr);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = flag;
			}
			finally
			{
				if (intPtr != value2)
				{
					value = Marshal.PtrToStringUni(intPtr);
				}
			}
			return result;
		}

		public bool get(out int value)
		{
			bool result = TD_DbPINVOKE.OdValue_get__SWIG_1(this.swigCPtr, out value);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool get(out double value)
		{
			bool result = TD_DbPINVOKE.OdValue_get__SWIG_2(this.swigCPtr, out value);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool get(out long date)
		{
			bool result = TD_DbPINVOKE.OdValue_get__SWIG_3(this.swigCPtr, out date);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool get(out double x, out double y)
		{
			bool result = TD_DbPINVOKE.OdValue_get__SWIG_4(this.swigCPtr, out x, out y);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool get(out double x, out double y, out double z)
		{
			bool result = TD_DbPINVOKE.OdValue_get__SWIG_5(this.swigCPtr, out x, out y, out z);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool get(OdDbObjectId objectId)
		{
			bool result = TD_DbPINVOKE.OdValue_get__SWIG_6(this.swigCPtr, OdDbObjectId.getCPtr(objectId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool get(out OdResBuf resBuf)
		{
			IntPtr zero = IntPtr.Zero;
			bool result;
			try
			{
				bool flag = TD_DbPINVOKE.OdValue_get__SWIG_7(this.swigCPtr, out zero);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = flag;
			}
			finally
			{
				resBuf = (OdResBuf)Teigha.Core.Helpers.odrxCreateObjectInternal(zero, true);
			}
			return result;
		}

		public bool get(out byte[] pBuf)
		{
			IntPtr zero = IntPtr.Zero;
			bool result;
			try
			{
				bool flag = TD_DbPINVOKE.OdValue_get__SWIG_8(this.swigCPtr, out zero);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = flag;
			}
			finally
			{
				pBuf = Helpers.UnmarshalByteArray(zero);
			}
			return result;
		}

		public bool set(OdValue value)
		{
			bool result = TD_DbPINVOKE.OdValue_set__SWIG_0(this.swigCPtr, OdValue.getCPtr(value));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool set(string value)
		{
			bool result = TD_DbPINVOKE.OdValue_set__SWIG_1(this.swigCPtr, value);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool set(int value)
		{
			bool result = TD_DbPINVOKE.OdValue_set__SWIG_2(this.swigCPtr, value);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool set(double value)
		{
			bool result = TD_DbPINVOKE.OdValue_set__SWIG_3(this.swigCPtr, value);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool set(out long date)
		{
			bool result = TD_DbPINVOKE.OdValue_set__SWIG_4(this.swigCPtr, out date);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool set(double x, double y)
		{
			bool result = TD_DbPINVOKE.OdValue_set__SWIG_5(this.swigCPtr, x, y);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool set(double x, double y, double z)
		{
			bool result = TD_DbPINVOKE.OdValue_set__SWIG_6(this.swigCPtr, x, y, z);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool set(OdDbObjectId objectId)
		{
			bool result = TD_DbPINVOKE.OdValue_set__SWIG_7(this.swigCPtr, OdDbObjectId.getCPtr(objectId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool set(OdResBuf resBuf)
		{
			bool result = TD_DbPINVOKE.OdValue_set__SWIG_8(this.swigCPtr, OdResBuf.getCPtr(resBuf));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool set(IntPtr buffer, int bufferSize)
		{
			bool result = TD_DbPINVOKE.OdValue_set__SWIG_9(this.swigCPtr, buffer, bufferSize);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool reset(OdValue.DataType nDataType)
		{
			bool result = TD_DbPINVOKE.OdValue_reset__SWIG_1(this.swigCPtr, (int)nDataType);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdValue.UnitType unitType()
		{
			OdValue.UnitType result = (OdValue.UnitType)TD_DbPINVOKE.OdValue_unitType(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setUnitType(OdValue.UnitType nUnitType)
		{
			TD_DbPINVOKE.OdValue_setUnitType(this.swigCPtr, (int)nUnitType);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public string getFormat()
		{
			string result = TD_DbPINVOKE.OdValue_getFormat(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setFormat(string pszFormat)
		{
			TD_DbPINVOKE.OdValue_setFormat(this.swigCPtr, pszFormat);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public string format(OdDbDatabase pDb)
		{
			string result = TD_DbPINVOKE.OdValue_format__SWIG_0(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public string format()
		{
			string result = TD_DbPINVOKE.OdValue_format__SWIG_1(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public string format(OdValue.FormatOption nOption, OdDbDatabase pDb)
		{
			string result = TD_DbPINVOKE.OdValue_format__SWIG_2(this.swigCPtr, (int)nOption, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public string format(OdValue.FormatOption nOption)
		{
			string result = TD_DbPINVOKE.OdValue_format__SWIG_3(this.swigCPtr, (int)nOption);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public string format(string pszFormat, OdValue.FormatOption nOption, OdDbDatabase pDb)
		{
			string result = TD_DbPINVOKE.OdValue_format__SWIG_4(this.swigCPtr, pszFormat, (int)nOption, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public string format(string pszFormat, OdValue.FormatOption nOption)
		{
			string result = TD_DbPINVOKE.OdValue_format__SWIG_5(this.swigCPtr, pszFormat, (int)nOption);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool format(string pszFormat, ref string pszValue, OdDbDatabase pDb)
		{
			IntPtr intPtr = Marshal.StringToCoTaskMemUni(pszValue);
			IntPtr value = intPtr;
			bool result;
			try
			{
				bool flag = TD_DbPINVOKE.OdValue_format__SWIG_6(this.swigCPtr, pszFormat, ref intPtr, OdDbDatabase.getCPtr(pDb));
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = flag;
			}
			finally
			{
				if (intPtr != value)
				{
					pszValue = Marshal.PtrToStringUni(intPtr);
				}
			}
			return result;
		}

		public bool format(string pszFormat, ref string pszValue)
		{
			IntPtr intPtr = Marshal.StringToCoTaskMemUni(pszValue);
			IntPtr value = intPtr;
			bool result;
			try
			{
				bool flag = TD_DbPINVOKE.OdValue_format__SWIG_7(this.swigCPtr, pszFormat, ref intPtr);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = flag;
			}
			finally
			{
				if (intPtr != value)
				{
					pszValue = Marshal.PtrToStringUni(intPtr);
				}
			}
			return result;
		}

		public bool convertTo(OdValue.DataType nDataType, OdValue.UnitType nUnitType)
		{
			bool result = TD_DbPINVOKE.OdValue_convertTo__SWIG_0(this.swigCPtr, (int)nDataType, (int)nUnitType);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool convertTo(OdValue.DataType nDataType, OdValue.UnitType nUnitType, bool bResetIfIncompatible)
		{
			bool result = TD_DbPINVOKE.OdValue_convertTo__SWIG_1(this.swigCPtr, (int)nDataType, (int)nUnitType, bResetIfIncompatible);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult dwgInFields(OdDbDwgFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdValue_dwgInFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void dwgOutFields(OdDbDwgFiler pFiler)
		{
			TD_DbPINVOKE.OdValue_dwgOutFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdResult dxfInFields(OdDbDxfFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdValue_dxfInFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void dxfOutFields(OdDbDxfFiler pFiler)
		{
			TD_DbPINVOKE.OdValue_dxfOutFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		[Flags]
		public enum DataType
		{
			kUnknown = 0,
			kLong = 1,
			kDouble = 2,
			kString = 4,
			kDate = 8,
			kPoint = 16,
			k3dPoint = 32,
			kObjectId = 64,
			kBuffer = 128,
			kResbuf = 256,
			kGeneral = 512,
			kColor = 1024
		}

		[Flags]
		public enum UnitType
		{
			kUnitless = 0,
			kDistance = 1,
			kAngle = 2,
			kArea = 4,
			kVolume = 8,
			kCurrency = 16,
			kPercentage = 32
		}

		[Flags]
		public enum ParseOption
		{
			kParseOptionNone = 0,
			kSetDefaultFormat = 1,
			kPreserveMtextFormat = 2,
			kConvertTextToValue = 4,
			kChangeDataType = 8,
			kParseTextForFieldCode = 16
		}

		[Flags]
		public enum FormatOption
		{
			kFormatOptionNone = 0,
			kForEditing = 1,
			kForExpression = 2,
			kUseMaximumPrecision = 4,
			kIgnoreMtextFormat = 8
		}
	}
}
